s = input()
while "()" in s or "{}" in s or "[]" in s or"<>":
    s = s.replace("()", "")
    s = s.replace("{}", "")
    s = s.replace("[]", "")
    s = s.replace("<>", "")
if s=="":
    print("True")
else:
    print("False")
